package com.hzhq.contract.convert;

import com.hzhq.contract.bean.dto.ContractStatusDTO;
import com.hzhq.contract.bean.dto.ContractTypeDTO;
import com.hzhq.contract.bean.entity.ContractStatus;
import com.hzhq.contract.bean.entity.ContractType;
import com.hzhq.contract.bean.vo.ContractStatusVO;
import com.hzhq.contract.bean.vo.ContractTypeVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author: hzhq1255
 * @mail: hzhq1255@163.com
 * @date: 2021/4/18 23:46
 * @desc:
 */
@Mapper
public interface ContractStatusConvertBasic {

    ContractStatusConvertBasic INSTANCE = Mappers.getMapper(ContractStatusConvertBasic.class);

    @Mappings({
            @Mapping(target = "statusId", expression = "java(com.hzhq.contract.util.ConvertUtil.objectIdToString(source.getStatusId()))"),
            @Mapping(target = "contractId", expression = "java(com.hzhq.contract.util.ConvertUtil.objectIdToString(source.getContractId()))")
    })
    ContractStatusDTO poToDto(ContractStatus source);

    @Mappings({
            @Mapping(target = "statusId", expression = "java(com.hzhq.contract.util.ConvertUtil.stringToObjectId(source.getStatusId()))"),
            @Mapping(target = "contractId", expression = "java(com.hzhq.contract.util.ConvertUtil.stringToObjectId(source.getContractId()))")
    })
    ContractStatus dtoToPo(ContractStatusDTO source);


    ContractStatusVO dtoToVo(ContractStatusDTO source);


    ContractStatusDTO voToDto(ContractStatusVO source);
}
